package com.example.security1.util.vo;


import com.example.security1.util.status.StatusCode;

public class Resp {
    /**
     * 无参数返回
     * @return 返回信息
     */
    public static ResultVO<Object> success() {
        return Vo(null, StatusCode.SUCCESS_CODE, null);
    }
    public static ResultVO<Object> success(String msg){
        return Vo(msg,StatusCode.SUCCESS_CODE,null);
    }
    /**
     * 返回带参数
     * @param msg 消息
     * @param data 数据
     * @return 返回信息
     */
    public static ResultVO<Object> success(String msg,Object data){
        return Vo(msg, StatusCode.SUCCESS_CODE, data);
    }
    public static ResultVO<Object> success(String msg,int code,Object data){
        return Vo(msg,code,data);
    }
    public static ResultVO<Object> Vo(String msg, int code, Object data) {
        return new ResultVO<>(msg, code, data);
    }

    /**
     * 错误返回
     * @return 错误信息
     */
    public static ResultVO<Object> error(){
        return Vo(null,StatusCode.ERROR_CODE,null);
    }
    public static ResultVO<Object> error(String msg){
        return Vo(msg, StatusCode.ERROR_CODE,null);
    }
    public static ResultVO<Object> error(String msg,int code,Object data){
        return Vo(msg,code,data);
    }
    public static ResultVO<Object> error(String msg,int code){
        return Vo(msg,code,null);
    }
    public static ResultVO<Object> error(String msg,Object data){
        return Vo(msg, StatusCode.ERROR_CODE,data);
    }
}
